<template>
  <div>
    <el-row type="flex" :gutter="20" style="padding-left: 20px">
      <h2 class="subtitle" style="margin-top: 20px; margin-left: 5px">温湿度记录</h2>
    </el-row>
    <el-tabs v-model="activeName">
      <el-tab-pane label="excel导出" name="first">
        <data-management></data-management>
      </el-tab-pane>
      <el-tab-pane v-if="userType==='管理人员'" label="变化趋势" name="second">
          <trend></trend>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
// import { reportURL } from '@/config/baseConfig'
import Trend from './trend'
// import Selector from '../../../../components/selector'
// import DataManagement from '../../../greenSeasons/src/compost/facilityDailyMaintain/dataManagement'
import DataManagement from './dataManagement'
// import ExcelUpload from './excelUpload'
//
export default {
  name: 'index',
  components: {
    // Selector,
    DataManagement,
    Trend
  },
  data () {
    return {
      src: this.$store.getters.getReportUrl + 'hsm%252F/temperatureAndHumidity.cpt&__bypagesize__=false&factory=' + this.$store.getters.getFactory,
      activeName: 'first',
      userType: null
    }
  },
  methods: {
  },
  beforeMount () {
    const user = JSON.parse(window.localStorage.getItem('user'))
    this.userType = user.value.type
    console.log(user.value.type)
    if (user.value.type === '一线员工') {
      this.activeName = 'second'
    }
  },
  mounted () {
    const oIframe = document.getElementById('reportFrame')
    const deviceWidth = Number(document.documentElement.clientWidth)
    const deviceHeight = Number(document.documentElement.clientHeight)
    oIframe.style.width = (deviceWidth - 130) / deviceWidth * 100 + 'vw' // 数字是页面布局宽度差值
    oIframe.style.height = (deviceHeight - 200) / deviceHeight * 100 + 'vh' // 数字是页面布局高度差
  }
}
</script>

<style scoped>
  >>>.el-tabs__item {
    background-color: #e6e9f2;
  }
  >>>.el-tab-pane{
    width: 100%;
  }
  >>>.el-tabs__content{
    width: 100%;
    height: 70%;
  }
</style>
